Merge Models using our own google drive models · Issue #14 · nolanaatama/sd 您所在的位置:网站首页 merge c Merge Models using our own google drive models · Issue #14 · nolanaatama/sd

Merge Models using our own google drive models · Issue #14 · nolanaatama/sd

#Merge Models using our own google drive models · Issue #14 · nolanaatama/sd| 来源: 网络整理| 查看: 265

Hi all:

I have been trying to change the mergemodels.ipynb file to allow me to load my own google drive models for mixing/merging with other models. However I am running into a problem in the 2nd cell execution, I cannot seem to get the google drive model to load (loading weight code does not execute). Models from huggingface can be loaded with no problems. I checked to make sure that my google drive model can be shared, that anyone with the link will be able to access it. The google drive model can be loaded for generating images through the loadgdrivemodel.ipynb so the model has no problems.

I made the code changes to mergemodel.ipynb by copying the first 2 sections/cells' code from loadgdrivemodel.ipynb, and pasting those onto the mergemodels.ipynb and saved the new file as mergemodelsgdrive.ipynb, please take a look to see if any code below is wrong, or if something is missing such that the gdrive model does not get loaded:

{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "gpuClass": "standard" }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "3xdPbMujWYJ8" }, "outputs": [], "source": [ "from google.colab import drive\n", "drive.mount('/content/drive')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "sBbcB4vwj_jm" }, "outputs": [], "source": [ "!pip install --upgrade fastapi==0.90.0\n", "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n", "\n", "########## paste our models code below .. \n", "\n", "# model 1 (change to our desired model code from google drive)\n", "!curl -Lo examp.ckpt /content/drive/MyDrive/stable diffusion/sdmodels/examplemodel.ckpt\n", "!mv "/content/examp.ckpt" "/content/stable-diffusion-webui/models/Stable-diffusion"\n", "\n", "# model 2 (change to our desired model code (below is code for standard SD2.1))\n", "!curl -Lo SD21768.ckpt https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.ckpt\n", "!mv "/content/SD21768.ckpt" "/content/stable-diffusion-webui/models/Stable-diffusion"\n", "\n", "# OPTIONAL model 3 (remove '#' from the beginning of both lines below if we want to merge 3 models and use the 'Add difference' option. Change both line to our desired model code (below is code for HassanBlend 1.4))\n", "# !curl -Lo hb.ckpt https://huggingface.co/hassanblend/hassanblend1.4/resolve/main/HassanBlend1.4-Pruned.ckpt\n", "# !mv "/content/hb.ckpt" "/content/stable-diffusion-webui/models/Stable-diffusion"\n", "\n", "########## paste our models code above ..\n", "\n", "%cd /content/stable-diffusion-webui\n", "!git checkout 11d432d # temporary fix\n", "!sed -i 's/else "cpu"/else devices.get_optimal_device()/g' modules/shared.py\n", "!sed -i "s/'cpu'/devices.get_optimal_device()/g" modules/extras.py\n", "!COMMANDLINE_ARGS="--share --lowvram --disable-safe-unpickle" REQS_FILE="requirements.txt" python launch.py" ] },

The rest of the code is not pasted here, as I have not made a single change to the original mergemodels.ipynb, maybe the problem lies within those lines below. However, I would be surprised since those codes relate to cell 3, 4 for testing the merged models and renaming the merged models and saving the new model back into google drive, etc.

During the execution of the 1st cell to connect to google drive, everything runs fine, just like how we use loadgdrivemodel.ipynb, I am able to see my gdrive model directory and models, and I can copy the path from the colab interface left panel.

During the execution of the 2nd cell, I see the errors very early on:

curl: (3) URL using bad/illegal format or missing URL mv: cannot stat '/content/examp.ckpt': No such file or directory

This is the reason why the google drive model: examp.ckpt does not get loaded later on, it is somehow considered a bad URL or missing URL, but I copied the link from the colab interface on the left side, expanding from drive/my drive/etc....right click to copy the path, exactly the same way we do to load our own google drive model using the loadgdrivemodel.ipynb, so the link path cannot be the problem. Again, I also made sure that the file is not restricted on google drive itself.

Therefore, I suspect that I am missing some code when I copied and pasted from loadgdrivemodel.ipynb, so that the altered mergegdrivemodels.ipynb cannot load the link properly.

Can anyone figure out how to correct my code above?



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有